﻿using System;
using System.Windows.Forms;
using GimmeRainbow.Properties;

namespace GimmeRainbow.Abstract
{
    public static class HelperClass
    {
        [Flags]
        public enum HashType
        {
            Md5 = 0x01,
            Sha1 = 0x02,
            Sha256 = 0x04,
            Sha386 = 0x08,
            Sha512 = 0x16,
            All = Md5 | Sha1 | Sha256 | Sha386| Sha512
        }

        public static void SetFileInTextBox(Control textBox)
        {
            using (var openFileDialog = new OpenFileDialog
            {
                CheckFileExists = true,
                InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
                Filter = Resources.MainForm_SetFileInTextBox_FileFilters
            })
            {

                if (openFileDialog.ShowDialog() != DialogResult.OK)
                    return;

                textBox.Text = openFileDialog.FileName;

            }
        }

        public static void SetDirectoryInTextBox(Control textBox)
        {
            using (var openFileDialog = new FolderBrowserDialog
            {
                RootFolder = Environment.SpecialFolder.DesktopDirectory,
                ShowNewFolderButton = true
            })
            {

                if (openFileDialog.ShowDialog() != DialogResult.OK)
                    return;

                textBox.Text = openFileDialog.SelectedPath;

            }
        }
    }
}
